<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/login.css">
</head>

<body>
    <div class="login">
        <div class="logo"></div>
        <div class="row">
            <input type="text" class="phone" id="phone" placeholder="输入手机号" autocomplete="off" value="13526878993">
        </div>
        <div class="row">
            <input type="password" class="pass" id="pass" placeholder="输入密码" value="123456">
        </div>
        <div class="row">
            <button id="btnLogin">登录</button>
        </div>
        <div class="row">
            未注册用户登录将自动创建报哪好账号，<b>即视为您已同意</b>
            <a href="#">《报哪好用户服务协议》</a>
        </div>
    </div>

    <script src="../js/jquery.min.js"></script>
    <script src="../js/jquery.cookie.min.js"></script>
    <script src="../js/purl.min.js"></script>

    <script>
        $(function () {
            $('#btnLogin').click(function () {
                let phone = $('#phone').val();
                let pass = $('#pass').val();

                /* $.post('/login', {
                    phone
                    pass
                }).then(function(){
                    // 保存cookie，并跳转
                }) */

                if (phone == '13526878993' && pass == '123456') {
                    // 保存一下登录状态
                    $.cookie('phone', phone, { expires: 1 });
                    let returnValue = $.url().param('returnValue');
                    // 保存当前激活选项卡
                    $.cookie('activeTab', returnValue);
                    location.href = `index.html`;
                }

            })
        })
    </script>
</body>

</html>